package com.meihua.shellapp.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;

import com.meihua.shellapp.R;

/**
 * 作者：lc on 2017/10/28.
 * 邮箱：lc0607live@163.com
 */

public class ShareAdapter extends BaseAdapter {
    private String[] names;
    private Integer[] drawables;
    private Context context;

    public ShareAdapter(Context context, String[] names, Integer[] drawables) {
        this.names = names;
        this.drawables = drawables;
        this.context = context;
    }

    @Override
    public int getCount() {
        return names == null ? 0 : names.length;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view = LayoutInflater.from(context).inflate(R.layout.item_dialog_share, null);
        ImageView img = view.findViewById(R.id.iv_img);
        img.setImageResource(drawables[i]);
        TextView tv_app = view.findViewById(R.id.tv_app);
        tv_app.setText(names[i]);
        return view;
    }
}
